<template>
    <!-- 基本信息 -->
    <div>
       <div class="title-wrapper">
        <title-name title="风险处理方案信息"></title-name>
        <a-icon
        v-if="showPlanBoardVisible"
        :type="planBoardVisible ? 'up' : 'down'"
        @click="planBoardVisible = !planBoardVisible"
        />
      </div>
      <div v-if="planBoardVisible">
        <custom-form ref="ruleForm" isValidate :formList="formList" :form="form" :editModel="onlyRead ? 'V' : 'E'"
        :isEmit="false">
            <template v-slot:fileInfos>
                <template v-if="!onlyRead">
                <l-table :fileAutoLoading="false" businessCode="QM14" :uploadArrys.sync="form.fileInfos"></l-table>
                <!-- <div class="file_prompt">请上传相关佐证资料</div> -->
                </template>
                <file-link v-else :fileList="form.fileInfos"></file-link>
          </template>    
        </custom-form>
      </div>
    </div>
  </template>
    
  <script>
  export default {
    name: 'a' + Date.now(),
    components: {
    },
    props: {
      // 表单
      form: {
        type: Object,
        default: () => ({})
      },
      // 只读模式
      onlyRead: {
        type: Boolean,
        default: () => false
      },
      // 是否显示箭头
      showPlanBoardVisible: {
        type: Boolean,
        default: () => false
      },
      // 默认展开
      defaultPlanBoardVisible: {
        type: Boolean,
        default: () => true
      }
    },
    computed: {
        // 表单配置项
        formList() {
            let list = [
                {
                    type: 'BaseTextarea',
                    keyName: 'handleOpinion',
                    label: '处理方案简述',
                    attrs: {
                      maxLength: 1000
                    },
                    rule: {
                      required: true,
                      whitespace: true,
                      message: '请输入处理方案简述',
                      trigger: 'change'
                    },
                    span: 24
                },
                {
                    slot: true,
                    keyName: 'fileInfos',
                    label: '上传附件',
                    span: 24,
                },
            ]
            return list
    },
  },
    watch: {
      defaultPlanBoardVisible: {
        handler(val) {
          this.planBoardVisible = val
        },
        immediate: true,
        deep: true
      },
    },
    data() {
      return {
        planBoardVisible: false,
      }
    },
    created() {
    },
    methods: {
    },
  }
  </script>
  <style lang="less" scoped>
  .title-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    .titleName {
      margin: 0;
    }
    .anticon {
      margin-left: 5px;
      font-size: 18px;
    }
  }
  </style>